﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using HundredMilesSoftware.UltraID3Lib;
using System.IO;
using NAudio.Wave;

namespace CSharpLearning
{
    class Program
    {
        static void Main(string[] args)
        {
            AspNetMembershipHelper helper = new AspNetMembershipHelper();
            helper.GenerateHash("Password01", "PPIfXUA9DoVxARn21rVfXQ==");
            //helper.GetUserInfo("100025");
            //System.Guid providerUserKey = new System.Guid("108AE366-D201-4FBB-AFB0-46ED18E71B1B");
            //helper.GetUserInfo(providerUserKey);
            //helper.GetUserInfo("5BBE6CCA-BCFE-4D20-8C0E-4F16C2552EFD");
            //var path = "C:\\inews_210435_10093683_20125240_10094885_453000_midebateonsocialwelfarebillstartstoday_a_210435_rte54fminews.mp3";
            //var path1 = "C:\\Atlas Genius - Trojans.mp3";
            //var path2 = "C:\\upload_video_test.mp4";            

            //double duration = 0.0;
            //using (FileStream fs = File.OpenRead(path))
            //{                
            //    Mp3Frame frame = Mp3Frame.LoadFromStream(fs);
            //    if (frame != null)
            //    {
            //        var _sampleFrequency = (uint)frame.SampleRate;
            //    }
            //    while (frame != null)
            //    {
            //        if (frame.ChannelMode == ChannelMode.Mono)
            //        {
            //            duration += (double)frame.SampleCount * 2.0 / (double)frame.SampleRate;
            //        }
            //        else
            //        {
            //            duration += (double)frame.SampleCount * 4.0 / (double)frame.SampleRate;
            //        }
            //        frame = Mp3Frame.LoadFromStream(fs);
            //    }
            //}            

            //Mp3FileReader mp3 = new Mp3FileReader(path2);
            //var aa = mp3.TotalTime.TotalMilliseconds;
            
            //Console.WriteLine("Duration: " + duration);
            //Console.WriteLine("Duration2: " + aa);
            //Console.WriteLine();

            //TagLib.File f = TagLib.File.Create(path);
            //var t = f.Properties.Duration.TotalMilliseconds;
            //var y = f.Properties.Duration;

            //UltraID3 id3 = new UltraID3();
            //id3.Read(path);
            //var q = id3.Duration;
            //var w = id3.Duration.TotalMilliseconds;



            //Console.WriteLine("UltraID3");
            //Console.WriteLine("TotalMilliseconds: " + w);
            //Console.WriteLine("Duration: " + q);
            //Console.WriteLine();

            //Console.WriteLine("TagLibSharp");
            //Console.WriteLine("TotalMilliseconds: " + t);
            //Console.WriteLine("Duration: " + y);

            //Console.ReadLine();
        }
    }
}
